import dayjs from "dayjs";
import { isNumber } from "lodash";

export default function datetimeFormat(
  date: number | string,
  format = "YYYY-MM-DD"
) {
  date = isNumber(date) ? date * 1000 : date;
  const now = dayjs(date);
  return now.format(format);
}
